/**
 * Created by LIUBA2 on 8/23/2016.
 */
const express =require("express");
const session=require("express-session");
const bodyParser=require("body-parser");

var app=express();
app.set("view engine","ejs");
app.set("views","views");

app.use(express.static("./public"));
app.use(session({secret:"abc"}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());

app.all("/order",function (req,res,next) {
    if(req.session.client){
        next();
    }
    else {
        res.json({error:"请先登录"});
    }
})



//通过主路由加载其他模块
//其他模块待实现
require("../routes/main.server.route")(app);

module.exports=app;